package org.liujing.jsw.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.event.dom.client.KeyUpEvent;
import com.google.gwt.event.dom.client.KeyUpHandler;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.*;
import static com.google.gwt.dom.client.Style.Unit.*;
import com.google.gwt.dom.client.*;
import org.liujing.jsw.client.border.*;

import org.liujing.jsw.client.border.*;
import org.liujing.jsw.client.ui.*;
import com.google.gwt.user.client.*;
import org.liujing.jsw.client.images.*;

import org.liujing.jsw.client.ui.Dimension;
import com.google.gwt.event.logical.shared.*;
import com.google.gwt.logging.client.*;
import java.util.logging.*;
/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class Jsswing implements EntryPoint {
  /**
   * The message displayed to the user when the server cannot be reached or
   * returns an error.
   */
  private static final String SERVER_ERROR = "An error occurred while "
      + "attempting to contact the server. Please check your network "
      + "connection and try again.";

  /**
   * Create a remote service proxy to talk to the server-side Greeting service.
   */
  private final GreetingServiceAsync greetingService = GWT.create(GreetingService.class);

  /**
   * This is the entry point method.
   */
   
   private TestImage image;
   /*
   VerPanel vp;
   HorPanel hp;
   */
  public void onModuleLoad() {
  	//java.util.logging.Logger.getLogger("client").addHandler(new ConsoleLogHandler());
  	//java.util.logging.Logger.getLogger("client").setLevel(Level.OFF);
  	image = GWT.create(TestImage.class);

  	VerPanel vp = new VerPanel();
  	HorPanel hp = new HorPanel();
  	hp.setBorder(new LineBorder("black", 5));
  	JLabel lable1 = new JLabel("[11111 111111]");
  	lable1.setBorder(new LineBorder("red", 5));
  	hp.add(lable1);
  	hp.add(new JLabel("[22222222222 22222222 2222222222222]"));
  	vp.add(hp);
  	
  	hp = new HorPanel();
  	hp.add(new JLabel(" My Component 3"));
  	hp.add(Box.createHorizontalGlue());
  	/*Button button = new Button("TEST");
  	WidgetWrapper wbutton = new WidgetWrapper(button);
  	//wbutton.setPreferredSize(new Dimension(150, 20));
  	//wbutton.setMinimumSize(new Dimension(150, 20));
  	hp.add(wbutton);
  	hp.add(new JLabel(" My Component 4"));
  	//hp.setBorder(ImageBorderFactory.createSmallRoundBorder());
  	*/
  	vp.add(hp);
  	/*
  	StackLayoutPanel sp = new StackLayoutPanel(PX);
	sp.add(new HTML("this content"), new HTML("this"), 24);
	sp.add(new HTML("that content"), new HTML("that"), 24);
	sp.add(new HTML("the other content"), new HTML("the other"), 24);
	
	//vp.add(new WidgetWrapper(sp));
	*/
  	vp.add(new ImageIcon(GWT.getModuleName()+ "/bundledimg/org/liujing/jsw/client/border/shadowBorder/ShadowImages_y.png"));
  	TestImage sampleImage = GWT.create(TestImage.class);
  	vp.add(new ImageIcon(sampleImage.getImg03()));
  	vp.add(new ImageIcon(GWT.getModuleName()+ "/test.gif"));
  	vp.setBorder(ImageBorderFactory.createSmallRoundBorder()); 
	    BrowserRootPanel rp = BrowserRootPanel.get();
	    //rp.setContent(new ScrollPanel(vp));
	    vp.add(new JLabel("test-----------------1--------------------"));
	    vp.add(new JLabel("test-----------------2--------------------"));
	    vp.add(new JLabel("test-----------------3--------------------"));
	    rp.setContent(vp);
   
   GWT.log("done");
  }
  
  public static native String getUserAgent()/*-{ 
     return navigator.userAgent.toLowerCase(); 
  }-*/;
  
  public static native String alertHTML()/*-{ 
     return document.getElementById("test").innerHTML; 
  }-*/;
 
}
